package com.phamloc.shootingchicken.objects;

import org.andengine.entity.scene.menu.item.SpriteMenuItem;
import org.andengine.entity.text.Text;
import org.andengine.entity.text.TextOptions;
import org.andengine.opengl.font.Font;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.util.adt.align.HorizontalAlign;

public class SpriteMenuItemWithText extends SpriteMenuItem{
	 private static final float HALF = 2f;
	private final Text mText;
	public SpriteMenuItemWithText(int pID, ITextureRegion pTextureRegion,
			VertexBufferObjectManager pVertexBufferObjectManager , String pText, Font pFont) {
		super(pID, pTextureRegion, pVertexBufferObjectManager);
		mText = new Text(0, 0, pFont, pText, new TextOptions(HorizontalAlign.CENTER),

                pVertexBufferObjectManager);

        final float hightBtn = pTextureRegion.getHeight();


        final float widtBtn = pTextureRegion.getWidth();


        final float positionX = widtBtn / HALF;

        final float positionY = hightBtn / HALF;

 

        mText.setX(positionX);

        mText.setY(positionY);

        attachChild(mText);
	}
	public void setBlendFunction(final int pBlendFunctionSource, final int pBlendFunctionDestination) {

		 

        mText.setBlendFunction(pBlendFunctionSource, pBlendFunctionDestination);

    }


    public void setAlpha(final float pAlpha) {

        super.setAlpha(pAlpha);

        mText.setAlpha(pAlpha);
}


    public void setColor(final float pRed, final float pGreen, final float pBlue){

        mText.setColor(pRed, pGreen, pBlue);

    }
}
